package com.chen.wxchat.service.impl;

import com.chen.wxchat.dao.ArticleDao;
import com.chen.wxchat.dao.ReplyDao;
import com.chen.wxchat.entity.Article;
import com.chen.wxchat.entity.Reply;
import com.chen.wxchat.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class ArticleServiceImpl implements ArticleService {

    @Autowired
    private ArticleDao articleDao;
    @Autowired
    private ReplyDao replyDao;

    @Override
    public boolean addArticle(Article article) {
        return (articleDao.insertArticle(article)>0);
    }

    @Override
    public boolean updateArticle(Article article) {

        return articleDao.updateArticle(article);
    }

    @Override
    public boolean updateArticleReadCount(Article article) {
        return articleDao.updateArticleReadCount(article);
    }

    @Override
    public List<Article> getArticleList(String articleId) {
        return articleDao.getArticleList(articleId);
    }

    @Override
    public List<Article> getAllArticleList() {
        return articleDao.getAllArticleList();
    }

    @Override
    public boolean addReply(Reply reply) {
        return replyDao.insertReply(reply);
    }
}
